﻿using Microsoft.AspNet.SignalR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WaterWay.Utilities
{
    /// <summary>
    /// 管理用户接口
    /// </summary>
    public class IManageUser : IUserIdProvider
    {
        /// <summary>
        /// 连接ID
        /// </summary>
        public string ConnectionId { get; set; }
        /// <summary>
        /// 用户主键
        /// </summary>
        public string UserId { get; set; }
        /// <summary>
        /// 用户编号
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 用户姓名
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 职务类型
        /// </summary>
        public decimal? DutyType { get; set; }
        /// <summary>
        /// 登陆账户
        /// </summary>
        public string Account { get; set; }
        /// <summary>
        /// 登陆密码
        /// </summary>
        public string Password { get; set; }
        /// <summary>
        /// 登录时间
        /// </summary>
        public DateTime LogTime { get; set; }
        /// <summary>
        /// 密钥
        /// </summary>
        public string Secretkey { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        public string Gender { get; set; }


        /// <summary>
        /// 部门Id(所在机构ID)
        /// </summary>
        public string SZJGId { get; set; }

        /// <summary>
        /// 部门Id（所属机构ID）
        /// </summary>
        public string SSJGId { get; set; }

        /// <summary>
        /// 所在科室
        /// </summary>
        public string SZKS { get; set; }

        /// <summary>
        /// 当前用户所在机构的所属机构
        /// </summary>
        public string SZJGSSJGDM { get; set; }
        /// <summary>
        /// 当前用户所属机构的所属机构
        /// </summary>
        public string SSJGSSJGDM { get; set; }
        /// <summary>
        /// 对象用户关系Id,对象分类:1-部门2-角色3-岗位4-群组
        /// 以角色为例，一个用户可以属于多个角色
        /// </summary>
        public string ObjectId { get; set; }
       

        /// <summary>
        /// 是否系统账户；拥有所有权限
        /// </summary>
        public bool IsSystem { get; set; }
        public int SystemID { get; set; }

        public string OrgType { get; set; }
        public string OrgName { get; set; }

        /// <summary>
        /// 所在科室名称
        /// </summary>
        public string SZKSName { get; set; }

        public DateTime LastLoginTime { get; set; }

        public string IPAddress { get; set; } 

        public string GetUserId(IRequest request)
        {
            if (request.GetHttpContext().Request.Cookies["userid"] != null)
            {
                return request.GetHttpContext().Request.Cookies["userid"].Value;
            }
            return "";
            // return Guid.NewGuid().ToString();
        }

    }
}
